#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
using namespace std;
const int N = 1e6 + 10;
int a[N];
int mp[N];
int kind; // 统计不同的数的个数

int main()
{
    int n, m;
    cin >> n >> m;
    for(int i = 1;i <= n;i++) cin >> a[i];

    int left = 1, right = 1;
    int ret = 0x3f3f3f3f;
    int x = 0, y = 0;
    while(right <= n)
    {
        // 进窗口
        if(mp[a[right]] == 0)
        {
            kind++;
            mp[a[right]]++;
        }
        else
        {
            mp[a[right]]++;
        }
        // 出窗口
        while(kind == m && mp[a[left]] > 1)
        {
            mp[a[left]]--;
            if(mp[a[left]] == 0)
            {
                kind--;
            }
            left++;
        }
        // 更新长度
        if(kind == m)
        {
            if(ret > right - left + 1)
            {
                ret = right - left + 1;
                x = left;
                y = right;
            }
        }
        right++;
    }

    cout << x << " " << y << endl;
}